﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DB_EntityFramework
{
    public class User
    {
        [Key]
        public int Id { get; set; }
        [Required(AllowEmptyStrings = false)]
        [MaxLength(50)]
        [Index(IsUnique = true)]
        public string Login { get; set; }
        [Required]
        public string Password { get; set; }
        [Required]
        public string Email { get; set; }
        //public int EmployeeID { get; set; }
        //public int EmployerID { get; set; }

        public virtual List<Roles> Roles { get; set; }

        public User()
        {
            Roles = new List<Roles>();
        }
        public User(Roles role)
            : this()
        {
            if (role != null)
                Roles.Add(role);
        }
        public User(List<Roles> roles)
            : this()
        {
            if (roles != null)
                Roles.AddRange(roles);
        }
    }
}
